<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>My notes</title>
<link rel="shortcut icon" href="__TMPL__Public/images/icon.png" />
<link type="text/css" rel="stylesheet" href="__TMPL__Public/css/common.css" media="all" />
<link type="text/css" rel="stylesheet" href="__TMPL__Group/css/showAllGroups.css" media="all" />

<link type="text/css" rel="stylesheet" href="__TMPL__Public/jquery/css/le-frog/jquery-ui-1.8.16.custom.css" media="all"  />
<script type="text/javascript" src="__TMPL__Public/jquery/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="__TMPL__Public/jquery/js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="__TMPL__Public/js/common.js"></script>

<script type="text/javascript">	
	$(function(){
		$(".buttons").button().css("font-size", "16px");
		$(".join_group_button").bind('click', function(){
			var group_id = $(this).attr('group_id');
			joinGroup(group_id, this);
		});
	});
	

    function joinGroup(group_id, button){
    	
        $.get(APP_PATH + "Group/join", {
            group_id: group_id
        }, function(result){
            result = JSON.parse(result);
			if(result.status == 1) {
				alert("已加入");
				$(button).val("进入");
				$(button).unbind('click');
				$(button).bind('click', function(){
					window.location = APP_PATH + "Group/groupPage?group_id=" + group_id;
				});
			}
        });
    }
</script>
</head>
<body id="group_item">
	<include file="Public:header"/>
	
	<div id="main_panel">
		<h2>所有小组</h2>
		<volist name="groups" id="group"> 
		<div class="each_group">
			<p>{$group.name}</p>
			<p>创建者：{$group.founder.name}</p>
			<p class="introduction">简介：{$group.introduction}</p>
			<in name="group.id" value="$user.group_ids">
				<a class="buttons" href="__APP__/Group/groupPage?group_id={$group.id}">进入</a>
			<else/>
				<input class="buttons join_group_button" group_id="{$group.id}" 
					type="button" value="加入小组"/>
			</in>
		</div>
		</volist>
		<p id="page_panel">{$page}</p>
	</div>
	<include file="Public:common"/>
</body>
</html>